<!-- include tpl=header menutitle=$page_rs.title -->
<section class="bg-light p-5"{if $cate_rs.banner || $page_rs.banner} style="background:url('{$cate_rs.banner ? $cate_rs.banner.filename : $page_rs.banner.filename}') center center no-repeat;background-size:cover;"{/if}>
	<h1 class="p-4 text-center">{$cate_rs ? $cate_rs.title : $page_rs.title}</h1>
	<!-- php:$taglist = $cate_rs.tag ? $cate_rs.tag : $page_rs.tag -->
	<!-- if $taglist -->
	<div class="container">
		<div class="text-center m-3">
			<span class="p-2 bg-light-50 rounded-lg">
			标签：
			<!-- loop from=$taglist key=$k value=$v id=$idxx -->
			{$v.html}<!-- if $idxx.total != $idxx.num -->，<!-- /if -->
			<!-- /loop -->
			</span>
		</div>
	</div>
	<!-- /if -->
</section>
<script type="text/javascript">
$(document).ready(function(){
	$("#book_post").submit(function(){
		//提交表单
		if(!$('#title').val()){
			$.dialog.alert("留言主题不能为空");
			return false;
		}
		if(!$('#fullname').val()){
			$.dialog.alert('留言人姓名不能为空');
			return false;
		}
		if(!$('#email').val()){
			$.dialog.alert('邮箱不能为空');
			return false;
		}
		var content = $("#content").val();
		if(!content){
			$.dialog.alert('留言内容不能为空');
			return false;
		}
		$(this).ajaxSubmit({
			'url':api_url('post','save'),
			'type':'post',
			'dataType':'json',
			'success':function(rs){
				if(rs.status == 'ok'){
					$.dialog.alert('您的留言信息已发布，请耐心等候管理员审核，感谢您的提交',function(){
						$.phpok.reload();
					},'succeed');
				}else{
					$.dialog.alert(rs.content,function(){
						$("#update_vcode").phpok_vcode();
						$("#_chkcode").val('');
					});
					return false;
				}
			}
		});
		return false;
	});
});
</script>
<section class="container"><div class="mt-3"><!-- include tpl=block/breadcrumb --></div></section>
<section class="container">
	<div class="card">
		<div class="card-header">
			发布新留言
		</div>
		<div class="card-body">
			<form method="post" id="book_post">
			<input type="hidden" name="id" id="id" value="{$page_rs.identifier}" />
			<!-- fields pid=$page_rs.id fields_format=1 in_title=1 -->
			<!-- loop from=$list key=$key value=$value -->
			<div class="form-group clearfix">
				<label for="{$value.identifier}">{$value.title}</label>
				{$value.html}
			</div>
			<!-- if $value.form_type == 'text' -->
			<script type="text/javascript">
			$(document).ready(function(){
				$("#{$value.identifier}").addClass("form-control");
			});
			</script>
			<!-- /if -->
			<!-- /loop -->
			<!-- if $sys.is_vcode && function_exists("imagecreate") -->
			<div class="form-group">
				<div class="row">
				<div class="col-sm-3"><input class="form-control"  type="text" name="_chkcode" id="_chkcode" placeholder="请填写验证码" /></div>
				<div class="col-sm-2"><img src="" border="0" align="absmiddle" id="vcode" class="hand" /></div>
				</div>
			</div>
			<script type="text/javascript">
			$(document).ready(function(){
				$("#vcode").phpok_vcode();
				$("#vcode").click(function(){
					$(this).phpok_vcode();
				});
			});
			</script>
			<!-- /if -->
			<div class="form-group d-block mt-4">
				<input name="" type="submit" class="btn btn-primary" value="提交" />
			</div>
			</form>
		</div>
	</div>
</section>
<!-- loop from=$rslist key=$key value=$value id=$tmpid -->
<section class="container">
	<div class="card mt-3">
		<div class="card-header">
			{$value.title}<small class="float-right">发布时间：{func time_format $value.dateline}</small>
		</div>
		<div class="card-body">
			<p class="card-text">{$value.content}</p>
			<!-- if $value.pic -->
			<div class="row row-cols-1 row-cols-sm-2 row-cols-md-4">
				<!-- loop from=$value.pic key=$k value=$v id=$idxx -->
				<div class="col p-2"><a href="{$v.gd.auto}" target="_blank"><img src="{$v.gd.thumb}" alt="{$v.title}" class="rounded" style="max-width:100%" /></a></div>
				<!-- /loop -->
			</div>
			<!-- /if -->
			<!-- if $value.adm_reply -->
			<fieldset class="admin-reply">
				<legend>管理员回复</legend>
				<div class="content">{$value.adm_reply}</div>
			</fieldset>
			<!-- /loop -->
		</div>
	</div>
</section>
<!-- /loop -->
<div class="mt-2"><!-- include tpl=block/pagelist --></div>
<!-- include tpl=footer -->